package cn.gdsdxy.dao;

import cn.gdsdxy.pojo.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface UserMapper {
    @Select("select COUNT(*) from a_user where username=#{username}")
    int getusername(String username);

    @Select("select COUNT(*) from a_user where username=#{username} and password=#{password}")
    int checkuser(User user);

    @Insert("insert into a_user (username,password,mobile)values(#{username},#{password},#{mobile})")
    int adduser(User user);

    @Delete("delete from a_user where username =#{username}")
    int deleteUser(String username);//返回受到影响的行数，如果返回值大于0，说明删除成功

    @Update("update a_user set password=#{password},mobile=#{mobile} where username = #{username}")
    int updatauser(User user);
}
